package org.gxuwz.core.action;

import java.util.List;

import org.gxuwz.core.entity.TChronicdisz;
import org.gxuwz.core.entity.TFamily;
import org.gxuwz.core.service.IChrDisSynService;
import org.gxuwz.core.service.IFamilyFilesService;
import org.springframework.beans.factory.annotation.Autowired;

import com.opensymphony.xwork2.ActionSupport;
import com.opensymphony.xwork2.ModelDriven;

public class ChrDisSynAction extends ActionSupport implements ModelDriven<TChronicdisz>{
     
	TChronicdisz Chrd= new TChronicdisz();
	List<TChronicdisz> list;
	String chrdissynid;
	String perscode;
	
	 @Autowired
	 IChrDisSynService ChrdService;
	@Override
	public TChronicdisz getModel() {
		return Chrd;
	}

	public String list() {
		list = ChrdService.getAll(chrdissynid, perscode);
		return "list";
	}
    
	public String sava(){
		System.out.println(Chrd.getChrdissynid()+"mmmmmmmmmmmmmmmmmmmmmmmmmm");
		ChrdService.addChrDisSynService(Chrd);
		
		return this.list();
	}
	
	public String getByPersCode(){
		Chrd = ChrdService.getByPersCode(perscode);
		return "list";
	}
	
	public String edit(){
		Chrd = ChrdService.getByPersCode(perscode);
		return "edit";
	}
	
	public String update(){
		ChrdService.update(Chrd);
		return list();
	}
	
	public String delete(){
		Chrd = ChrdService.getByPersCode(perscode);
		ChrdService.delete(Chrd);
		return this.list();
	}

	public TChronicdisz getChrd() {
		return Chrd;
	}

	public void setChrd(TChronicdisz chrd) {
		Chrd = chrd;
	}

	public List<TChronicdisz> getList() {
		return list;
	}

	public void setList(List<TChronicdisz> list) {
		this.list = list;
	}

	public String getChrdissynid() {
		return chrdissynid;
	}

	public void setChrdissynid(String chrdissynid) {
		this.chrdissynid = chrdissynid;
	}

	public String getPerscode() {
		return perscode;
	}

	public void setPerscode(String perscode) {
		this.perscode = perscode;
	}

	public IChrDisSynService getChrdService() {
		return ChrdService;
	}

	public void setChrdService(IChrDisSynService chrdService) {
		ChrdService = chrdService;
	}
	
	
}
